home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1994
/
MacHack 1994.toast
/
MacHack™ 1987-1994
/
MacHack™ '87
/
Utilities ƒ
/
Text Editors ƒ
/
MEDIT ƒ
/
FORTRAN MACRO
< prev
next >
Wrap
Text File
|
1986-06-09
|
4KB
|
173 lines
**************************************************************************
* Fortran Macros Version 0.5 June 5, 1986 *
* by Gary White (CompuServe 74065,1636) based on Pascal.mcr *
* example by Matthias Aebi *
**************************************************************************
* Macros 1 and 2 should be run to initialize to your preferred values of
* logical unit numbers for standard input and output, and to initialize
* line numbers for Do loops and for Format statements. Also, these
* macros work best with 'Auto Indent' turned OFF.
* Comments welcome!
* 1
* Choose read and write logical unit numbers
"LUN/U" {
SET(#0,10);
SET(#1,1000);
SET(#5,5);
prompt("READ UNIT#",#5);
Set($5,str(#5));
SET(#6,6);
prompt("WRITE UNIT#",#6);
Set($6,str(#6));
};
* 2
* Specify line number label
"Label/L" {
prompt("Start line numbers at ",#0);
Set($0,str(#0));
PROMPT("Start Format Line Numbers at ",#1);
SET($1,STR(#1));
};
* 3
* insert a line in the menu
"-" {};
* 4
* jumps to the next placeholder structure
"Placeholder/-" {
Find("{.");
If L: = 0 And C: = 0 {
Find("{.");
};
Push;
Find(".}");
Select(L[,C[ | L:,C:)!;
Drop;
};
* 5
* insert a line in the menu
"-" {};
* 6
* insert a DO template
"Do/D" {
Push;
Insert(" DO ");
Insert($0);
Insert(" {.index.}={.start.},{.end.}\n");
Insert(" {.body.}\n");
Insert($0);
Insert(" CONTINUE\n");
Set(#0,#0+10);
Set($0,STR(#0));
Call(17);
};
* 7
* insert a SUBROUTINE template
"Subroutine/S" {
Push;
Insert(" SUBROUTINE {.ProcName.} ({.Parameters.})\n");
Insert(" {.body.}\n");
Insert(" RETURN\n");
Insert(" END\n");
SET(#0,10);
SET(#1,1000);
SET($0,STR(#0));
SET($1,STR(#1));
Call(17);
};
* 8
* insert a FUNCTION template
"Function/F" {
Push;
Insert(" FUNCTION {.ProcName.} ({.Parameters.})\n");
Insert(" {.body.}\n");
Insert(" RETURN\n");
Insert(" END\n");
SET(#0,10);
SET(#1,1000);
SET($0,STR(#0));
SET($1,STR(#1));
Call(17);
};
* 9
* READ statement
"Read/R" {
Push;
Insert(" READ(");
Insert($5);
Insert(",");
Insert($1);
Insert(") {.list.}\n");
Call(17);
};
* 10
* Write statement
"Write/W" {
Push;
Insert(" WRITE(");
Insert($6);
Insert(",");
Insert($1);
Insert(") {.list.}\n") ;
Call(17);
};
* 11
* insert an IF-THEN-ENDIF template
"If/I" {
Push;
Insert(" IF ({.Condition.}) THEN\n {.Statement.}\n");
Insert(" ENDIF\n");
Call(17);
};
* 12
* insert an OPEN template
"Open/P" {
* open (5,file='oburden.data',status='old')
Push;
Insert(" OPEN({.lun.},file={.file.},status={.status.})\n");
Call(17);
};
* 13
* Insert CALL line
"Call/A" {
Push;
Insert(" CALL {.subroutine.}({.arguments.})\n");
};
* 14
* Insert FORMAT line
"Format/M" {
Push;
Insert($1);
Insert(" FORMAT({.specifications.})\n");
Set(#1,#1+10);
Set($1,STR(#1));
CALL(17);
};
* 15
* Insert a comment line
"Comment/K" {
Push;
Insert("C\n");
};
* 16
* Insert a separator line
"Border/B" {
Push;
Insert("C ------------------------------------------------------\n");
};
* 17
* select first placeholder
{
Pop;
Find("{.");
Push;
Find(".}");
Select(L[,C[ | L:,C:)!;
Drop;
}.